home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS04.ADF / image.ed / colors.c < prev    next >
C/C++ Source or Header  |  1985-10-26  |  3KB  |  95 lines

  1.  
  2. /************* colors.c******************/
  3. /* this file contains the information required for the colors
  4.  * menu.  It is a mix of graphics (the colors themselves) and
  5.  * text "modify these colors" 
  6.  */
  7.  
  8. #include "intuall.h"
  9. #include "imageedit.h"
  10. #define ITEMSTUFF (ITEMENABLED | HIGHBOX)
  11. #define CW 40   /* color block width and height for color palette */
  12. #define CH 25
  13.  
  14. extern struct TextAttr TestFont;
  15.  
  16. struct MenuItem cc;
  17. struct IntuiText cctext;
  18.  
  19. struct Image colorimage[32];            /* provide for max possible */
  20. struct MenuItem coloritem[32];
  21.         
  22. SHORT palette[]  = { 2, 4, 8, 16, 32 };
  23.  
  24. InitColorItems( depth )         /* depending on depth of playfield,
  25.                                  * provide fewer items in the menu
  26.                                  */
  27. SHORT depth;
  28. {
  29.         SHORT n,colors;
  30.  
  31.         colors = palette[depth-1];      
  32.         for(n=0; n<colors; n++)
  33.         {
  34.         coloritem[n].NextItem = &coloritem[n+1];
  35.         coloritem[n].ItemFill = (APTR)&colorimage[n];
  36.         coloritem[n].LeftEdge = 2 + CW * (n % 4);
  37.         coloritem[n].TopEdge = CH * (n / 4);
  38.         coloritem[n].Width = CW;
  39.         coloritem[n].Height = CH;
  40.         coloritem[n].Flags = ITEMSTUFF;
  41.         coloritem[n].MutualExclude = 0;
  42.         coloritem[n].SelectFill = NULL;
  43.         coloritem[n].Command = 0;
  44.         coloritem[n].SubItem = NULL;    
  45.         coloritem[n].NextSelect = 0;
  46.  
  47.         colorimage[n].LeftEdge = 1;
  48.         colorimage[n].TopEdge = 1;
  49.         colorimage[n].Width = CW-2;
  50.         colorimage[n].Height = CH-2;
  51.         colorimage[n].Depth = depth;
  52.         colorimage[n].ImageData = NULL;
  53.         colorimage[n].PlanePick = 0;
  54.         colorimage[n].PlaneOnOff = n;
  55.         }
  56.         coloritem[colors-1].NextItem = &cc;
  57.         Initcctext(depth);
  58.         return(0);
  59. }
  60.  
  61. /* cc means color change, has to appear below lowest line of the
  62.  * color selection menu display.
  63.  *
  64.  * This is a case where you are mixing text and graphics in the 
  65.  * same menu */
  66.  
  67. Initcctext(depth)
  68. SHORT depth;
  69. {
  70.         cc.NextItem = NULL;
  71.         cc.LeftEdge = 0;
  72.         cc.TopEdge = 4+ CH * ((palette[depth-1])>>2);
  73.         cc.Width = 160;
  74.         cc.Height = 10;
  75.         cc.Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
  76.         cc.MutualExclude = 0;
  77.         cc.ItemFill = (APTR)&cctext;
  78.         cc.SelectFill = NULL;
  79.         cc.Command = 0;
  80.         cc.SubItem = NULL;
  81.         cc.NextSelect = 0;
  82.  
  83.         cctext.FrontPen = 0;
  84.         cctext.BackPen = 1;
  85.         cctext.DrawMode = JAM2;
  86.         cctext.LeftEdge = 0;
  87.         cctext.TopEdge = 1;
  88.         cctext.ITextFont = &TestFont;
  89.         cctext.NextText = NULL;
  90.         cctext.IText = (UBYTE *)"Modify These Colors";
  91.         return(0);
  92. }
  93.  
  94.  
  95.